package cn.com.surker.oa.entity;

import cn.com.surker.material.entity.MainMaterialContractPrice;
import cn.com.surker.material.entity.MainMaterialTransportCar;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import java.time.LocalDateTime;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

import javax.validation.constraints.NotNull;

/**
 * <p>
 * 材料合同(主材、材料运输、材料销售)
 * </p>
 *
 * @author admin
 * @since 2022-10-05
 */
@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
public class OaMaterialContract implements Serializable {

    private static final long serialVersionUID = 1L;

    /**
     * id
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    private String code;

    /**
     * 合同类型(0:材料合同1:材料运输合同2:材料销售合同,3:运输(船))
     */
    @NotNull(message = "请选择合同类型")
    private Integer type;

    /**
     * 材料ID
     */
    @NotNull(message = "请选择材料")
    private String materialId;

    /**
     * 材料全称
     */
    private String material;

    /**
     * 性质(0;正式,1:临时)
     */
    private Integer quality;

    /**
     * 公司ID
     */
    @NotNull(message = "请选择公司")
    private Long orgId;

    /**
     * 公司名称
     */
    @NotNull(message = "请选择公司")
    private String orgName;

    /**
     * 合同内容
     */
    private String content;

    /**
     * 联系人
     */
    private String linkMan;

    /**
     * 联系电话
     */
    private String phone;

    /**
     * 过磅结算类型(0:按过磅结算1:按供方结算)
     */
    private Integer billWeightType;

    /**
     * 合同名称
     */
    private String name;

    /**
     * 开始日期
     */
    private String startDate;

    /**
     * 结束日期
     */
    private String endDate;

    /**
     * 签订日期
     */
    private String signDate;

    /**
     * 供应公司id
     */
    @NotNull(message = "请选择供应商")
    private Long sid;

    /**
     * 过磅等待时间
     */
    private Integer waitTime;
    /**
     * 是否含税(0:不含税1:含税)
     */
    private Integer isTaxPrice;
    /**
     * 含税率(%)
     */
    private Double rate;

    /**
     * 是否启用(0:启用1:暂停)
     */
    private Integer enable;

    /**
     * 状态(0:启用1:禁用)
     */
    private Integer status;
    /**
     * 是否上传附件
     */
    private Integer isUpload;
    /**
     * 备注
     */
    private String remark;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
    private Date createTime;

    private String creator;

    private Date updateTime;

    private String updator;
    /**
     * 合同材料价格
     */
    @TableField(exist = false)
    private List<MainMaterialContractPrice> priceList = new ArrayList<>();

    /**
     * 运输车辆信息
     */
    @TableField(exist = false)
    private List<MainMaterialTransportCar> carList = new ArrayList<>();

    public OaMaterialContract(){}
    public OaMaterialContract(String code, Integer type, String materialId, String material, Integer quality, Long orgId,
                              String orgName, String linkMan, String phone, String name, String startDate, String endDate,
                              String signDate, Long sid, Integer status, String remark, Date createTime) {
        this.code = code;
        this.type = type;
        this.materialId = materialId;
        this.material = material;
        this.quality = quality;
        this.orgId = orgId;
        this.orgName = orgName;
        this.linkMan = linkMan;
        this.phone = phone;
        this.name = name;
        this.startDate = startDate;
        this.endDate = endDate;
        this.signDate = signDate;
        this.sid = sid;
        this.status = status;
        this.remark = remark;
        this.createTime = createTime;
    }

    @Override
    public String toString() {
        return "OaMaterialContract{" +
                "id=" + id +
                ", code='" + code + '\'' +
                ", type=" + type +
                ", materialId='" + materialId + '\'' +
                ", material='" + material + '\'' +
                ", quality=" + quality +
                ", orgId=" + orgId +
                ", orgName='" + orgName + '\'' +
                ", content='" + content + '\'' +
                ", linkMan='" + linkMan + '\'' +
                ", phone='" + phone + '\'' +
                ", billWeightType=" + billWeightType +
                ", name='" + name + '\'' +
                ", startDate='" + startDate + '\'' +
                ", endDate='" + endDate + '\'' +
                ", signDate='" + signDate + '\'' +
                ", sid=" + sid +
                ", waitTime=" + waitTime +
                ", isTaxPrice=" + isTaxPrice +
                ", rate=" + rate +
                ", enable=" + enable +
                ", status=" + status +
                ", remark='" + remark + '\'' +
                ", createTime=" + createTime +
                ", creator='" + creator + '\'' +
                ", updateTime=" + updateTime +
                ", updator='" + updator + '\'' +
                ", priceList=" + priceList +
                ", carList=" + carList +
                '}';
    }
}
